<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>要跳转到此页面</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
</head>
<body>
<script>

    /*
    a.html?sno=2013&name=sunq
    将链接问号后的字符串转化成一个对象，可以根据sno拿到2013，根据name拿到sunq

     location.search返回问号已经问号后面的所有字符
     X.substr(1) 拿到X这个字符串的从下标1到最后一个字符的字符子串，此情形下就是处理掉问号
     X.split('&') 返回一个以&号分割开的数组*/
    function query_params() {
        var params={};
        var bigArray = location.search.substr(1).split('&');
        console.log(bigArray);
        for(var i=0;i<bigArray.length;i++){

            var a = bigArray[i].split('=')[0];
            var b = bigArray[i].split('=')[1];
            params[a]=b;
        }
        return params;
    }
    console.log(query_params());


</script>
</body>
</html>